package dk.dashboardFP.panels.loggerPanel {
	import flash.display.Sprite;

	/**
	 * @author josef
	 */
	public class LevelFilterUI extends Sprite {
		private var _levels : Array;
		private var _selectedButton : LevelButton;

		public function LevelFilterUI() {
			
			setupElements();
		}
		
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		// setup
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		private function setupElements() : void {
			
			_levels=[];
			
			for (var i : Number = 0; i < 4; i++) {
				
				var levelButton:LevelButton=new LevelButton(i);
				
				addChild(levelButton);
				levelButton.x=LevelMarkers.MARK_SPACE_X* i;
				
				_levels[_levels.length] = levelButton;
			}
		}

		public function selectLevel(level:int) : void {
			
			// deselct old 
			if (_selectedButton) {
				_selectedButton.oController.setDeSelected();
			}
			
			// select new 
			LevelButton(_levels[level]).oController.setSelected();
			_selectedButton=LevelButton(_levels[level]);
		}
	}
}
